package jp.co.showbiz.admin.talent.dao;

import java.sql.SQLException;
import java.util.HashMap;
import java.util.List;

import jp.co.showbiz.admin.talent.imp.TalentDto;
import jp.co.showbiz.admin.talent.imp.TalentPickupDto;
import jp.co.showbiz.common.base.BaseBean;
import jp.co.showbiz.common.base.BaseDAO;

public class TalentDao extends BaseDAO {
	public TalentDao() throws Exception {
		super();
	}
	
	public Object insert(TalentDto dto) throws SQLException {
//		int talent_id = getMaxId();
		return insert("talentInsert", dto);
	}

	public Object talentContentInsert(TalentDto dto) throws SQLException {		
		return insert("talentContentInsert", dto);
	}

	public Object talentContentInsertTA(TalentDto dto) throws SQLException {		
		return insert("talentContentInsertTA", dto);
	}
	
	public Object talentContentUpdatePI(TalentDto dto) throws SQLException {		
		return insert("talentContentUpdatePI", dto);
	}
	
	public Object maxTalentId(Object obj) throws SQLException {
		return objSelect("maxTalentId", obj);
	}

	public Object maxContentId(Object obj) throws SQLException {
		return objSelect("maxContentId", obj);
	}

	public Object getTalentContent(Object obj) throws SQLException {
		return objSelect("getTalentContent", obj);
	}
	
	public Object talentContentInsertName(TalentDto dto) throws SQLException {
				
		return insert("talentContentInsertName", dto);
	}
	
	@SuppressWarnings("unused")
	private int getMaxId() throws SQLException {
		// TODO Auto-generated method stub
		return (Integer) sqlMap.queryForObject("talentMaxId");
	}

	public void update(BaseBean bean) throws SQLException {
		update("talentUpdate", bean);
	}

	public void groupDelete(BaseBean bean) throws SQLException {
		update("talent.groupDelete", bean);
	}

	public void groupUpdate(BaseBean bean) throws SQLException {
		update("talent.groupUpdate", bean);
	}
	
	public void delete(BaseBean bean) throws SQLException {
		delete("talentDelete", bean);
	}
	
	public String getTotalCount() throws SQLException {
		return (String) sqlMap.queryForObject("getTotalCount");
	}

	public String getSearchCount(Object params) throws SQLException {
		return (String) sqlMap.queryForObject("getSearchCount", params);
	}
	
	public String getTalentId() throws SQLException {
		return (String) sqlMap.queryForObject("getTalentId");
	}
	
	@Override
	public <TalentDto> List<TalentDto> select(String statementName, Object params) throws SQLException {
		return super.select(statementName, params);
	}
	public <TalentDto> List<TalentDto> selectList() throws SQLException{
		return super.select("talentSelectList");
	}
	
	public <TalentDto> List<TalentDto> selectList(Object params) throws SQLException {
		return super.select("talentSelectList", params);
	}
	
	public <TalentBunyaMstBean> List<TalentBunyaMstBean> selectListPage(Object params, int skip, int maxSize) throws SQLException {
		return super.select("talentSelectList", params, skip, maxSize);
	}

	public <TalentDto> List<TalentDto> selectSearchList(Object params) throws SQLException {
		return super.select("talentSearch", params);
	}
	
	public <TalentDto> List<TalentDto> selectSearchListPage(Object params, int skip, int maxSize) throws SQLException {
		return super.select("talentSearch", params, skip, maxSize);
	}
	
	public <TalentBunyaMstBean> List<TalentBunyaMstBean> selectBunya(Object params) throws SQLException {
		return super.select("talentBunyaList", params);
	}
	
	@Override
	public Object objSelect(String statementName, Object params) throws SQLException {
		return super.objSelect(statementName, params);
	}
	
	public Object objSelect(Object params) throws SQLException {
		return super.objSelect("talentSelect", params);
	}

	public <TalentPickupDto> List<TalentPickupDto> getPickList() throws SQLException {
		// TODO Auto-generated method stub
		return super.select("talentPickupList");
	}

	public void regPickup(TalentPickupDto tpDto) throws SQLException {
		// TODO Auto-generated method stub
		super.delete("talentPickupDel", tpDto);
		super.insert("talentPickupReg", tpDto);
	}

	public int getContentId(String talent_id) throws SQLException {
		// TODO Auto-generated method stub
		return (Integer) objSelect("getContentId", talent_id);
	}
	
	public List<HashMap<String, Object>> getListTalent(Object obj) throws SQLException {
		List<HashMap<String, Object>> list = select("talent.selectListTalent", obj);
		return list;
	}

	public List<HashMap<String, Object>> getListTalentGroup(Object obj) throws SQLException {
		List<HashMap<String, Object>> list = select("talent.selectListTalentGroup", obj);
		return list;
	}
	
}
